{template header}

    {template sidebar}
    <!-- artile begin -->
    <div class="article">
        {template title}

    <!--{if $type == 'infoMan'}-->
    <!--{if $a == 'index'}-->
        <div class="view">
            <h1>筛选</h1>
            <ul>
                <li>
                    <span>商品种类：</span>
                 <!--{loop $this->salerType $v}-->
                    <a href="{$this->url($c, null, array('k' => 'salerType', 'v' => $v) )}">{$v}</a>
                 <!--{/loop}-->
                </li>
                <li>
                    <span>商品来源：</span>
                    <!--{loop $this->source $v}-->
                    <a href="{$this->url($c, null, array('k' => 'source', 'v' => $v) )}">{$v}</a>
                    <!--{/loop}-->
                </li>
            </ul>
        </div>
        <table>
            <tr>
                <th width="5%"><input type="checkbox" class="checkbox all" /> </th>
                <th>商品名称</th>
                <th width="10%">评分</th>
                <th width="10%">评论</th>
                <th width="10%">销售额</th>
                <th width="15%">操作</th>
            </tr>
        <!--{if $result}-->
            <!--{loop $result $v}-->
            <tr>
                <td><input type="checkbox" name="id" value="{$v['id']}" /></td>
                <td>{$v['title']}</td>
                <td>{$v['vote']}</td>
                <td>{$v['comments']}</td>
                <td>{echo number_format($v['price'] * $v['total'],2)}</td>
                <td class="operate">
                    <a href="{$this->url($c,'edit',array('id'=>$v['id'],'type'=>'infoMan'))}">编辑</a>
                    <a title="删除商品" class="del" href="{$this->url($c,'del',array('id'=>$v['id']))}">删除</a>
                </td>
            </tr>
            <!--{/loop}-->
        <!--{else}-->
            <tr>
                <td colspan="6">没有{$this->name}！
                </td>
            </tr>
        <!--{/if}-->

        <!--{if $pager}-->
            <!--分页开始-->
            <tr>
                <td colspan="6">
                    <div class="page">{$pager}</div>
                </td>
            </tr>
            <!--分页结束-->
        <!--{/if}-->
        </table>
        <div class="margin">
            <div class="right">
                <form class="form-search" action="{$this->url($c, null, $this->get())}">
                    <div class="input-append">
                        <input type="text" name="key" class="span2 search-query" placeholder="请输入商品名称" />
                        <button type="button" class="btn search">搜索</button>
                    </div>
                </form>
            </div>
            <div class="left">
                <a href="{$this->url($c, 'add',array('type'=>'infoMan'))}" class="btn btn-success">添加{$this->name}</a>
            </div>
        </div>
        <div class="clear"></div>
    <!--{/if}-->
     <!--{if $a == 'add' || $a == 'edit'}-->
        <form method="post" action="{$this->url($c, 'save', array('id' => $result['id']))}">
            <input type="hidden" name="attach[id]" value="" />
            <input type="hidden" name="uid" value="{$this->admin['id']}" />
            <table>
                <tr>
                    <td class="td1" width="25%">商品编号：</td>
                    <td class="td2 operate">
                        <input type="text" name="sn" placeholder="请输入商品编号" class="required" value="{$a == 'edit' ? $result['sn'] : ''}"/>
                        <a format="YmdHis" class="sn" href="{$this->url($c)}">自动生成</a>
                    </td>
                </tr>
                <tr>
                    <td class="td1">商品名称：</td>
                    <td class="td2">
                        <input type="text" name="title" placeholder="请输入商品名称" class="required input-xlarge" value="{$a == 'edit' ? $result['title'] : ''}" />
                    </td>
                </tr>
                <tr>
                    <td class="td1">商品货号：</td>
                    <td class="td2">
                        <input type="text" name="materialNo" placeholder="请输入商品名称" class="required input-xlarge" value="{$a == 'edit' ? $result['materialNo'] : ''}" />
                    </td>
                </tr>

                <tr>
                    <td class="td1">商品种类：</td>
                    <td class="td2">
                        <select name="picType">
                            <!--{loop $this->salerType $v}-->
                            {eval $select_salerType = $v == $result['salerType'] ? ' selected' : ''}
                            <option value="{$v}"{$select_salerType}>{$v}</option>
                            <!--{/loop}-->
                        </select>
                    </td>
                </tr>
                <tr>
                    <td class="td1">信息来源：</td>
                    <td class="td2">
                        <select name="source">
                            <!--{loop $this->source $v}-->
                            {eval $select = $v == $result['source'] ? ' selected' : ''}
                            <option value="{$v}"{$select}>{$v}</option>
                            <!--{/loop}-->
                        </select>
                    </td>
                </tr>
                <tr>
                    <td class="td1">所属品牌：</td>
                    <td class="td2 operate">
                        <input type="text" name="brand" placeholder="请输入商品所属品牌" class="required" value="{$a == 'edit' ? $result['brand'] : ''}" />
                        <a href="" class="brand">森马</a>
                        <a href="" class="brand">阿迪达斯</a>
                        <a href="" class="brand">贵人鸟</a>
                        <a href="" class="brand">匹克</a>
                        <a href="" class="brand">李宁</a>
                        <a href="" class="brand">其他</a>
                    </td>
                </tr>

                <tr>
                    <td class="td1">商品销售价格：</td>
                    <td class="td2">
                        <input type="text" name="price" placeholder="请输入商品销售价格" class="required" value="{$a == 'edit' ? $result['price'] : ''}" />
                    </td>
                </tr>
                <tr>
                    <td class="td1">录入时间：</td>
                    <td class="td2 operate">
                        <input type="text" name="dateline" value="{$a == 'edit' ? date($this->setting['timeformat'], $result['dateline']) : date($this->setting['timeformat'])}" readonly />
                        <a href="" format="{$this->setting['timeformat']}" class="dateline">插入当前时间</a>
                    </td>
                </tr>
                {template upload}
                <tr>
                    <th colspan="2" class="td4"><a title="保存{$this->name}" class="btn btn-success save" href="{$this->url($c)}">保存</a></th>
                </tr>
            </table>
        </form>
        <script type="text/javascript">
            $( ".style,.brand" ).click( function () {
                var c = $( this ).attr( 'class' );
                $( 'input[name="' + c + '"]' ).val( $( this ).html() );
                $( 'input[name="' + c + '"]' ).focus();
                return false;
            });
            $( ".sn, .dateline" ).click( function () {
                var c = $( this ).attr( 'class' );
                $.get( "{$this->url($c, 'get_date')}&format=" + $( this ).attr( 'format' ), function ( result ) {
                    $( 'input[name="' + c + '"]' ).val( result );
                    $( 'input[name="' + c + '"]' ).focus();
                });
                return false;
            });
        </script>
    <!--{/if}-->
    <!--{/if}-->


    <!--{if $type == 'infoShow'}-->
        <!--{if $a != 'addClothEvaluate' && $a != 'lookClothEvaluate' }-->
        <!-- 信息展示 -->

        <table cellpadding="1" cellspacing="1" border="0" width="100%">


            <tr>
                <td class="td1" width="30%">请选择服装类型：</td>
                <td class="td2" colspan="2">
                    <!-- class="required" 必填字段  -->

                    <!--  <input type="text" name="discount" placeholder="请输入供货商折扣信息" value="{$a == 'edit' ? $result['discount'] : ''}" />  -->

                    <select name="clothType" onchange="template(this.value)">
                        <!--{loop $this->salerType  $k $v}-->
                        <option value="{$k}" {$k == $t?'selected':''}>{$v}</option>
                        <!--{/loop}-->
                    </select>

                    <script>
                        function template( v ) {
                            var url = "{$this->url($c,'lookHotSalePic',array('type'=>G('type')))}";
                            window.location.href = url + "&t=" + v;
                        }
                    </script>

                </td>

            </tr>
        </table>

        <table>
            <!--{if  $result}-->
            <style>

                .slideshow{ height:280px; position:relative;  width:300px;overflow:hidden;}
                .slides_container{ height:280px !important;}
                .slideshow img{ width:300px; height:280px;}
                .pagination{ float:right; position:absolute; bottom:6px; right:6px;}
                .pagination li{ float:left; margin:0 1px;}
                .pagination li a{  float:left; width:16px; height:16px; line-height:16px; font-size:12px;text-align:center;color:#333; background:#FFF; overflow:hidden; display:block;}
                .pagination li.current a{ color:#FFF; background:#06C;}
            </style>
            <!--{loop $result $val}-->

            <tr>
                <td  width=300>
                    <div class="slideshow">
                        <div class="slides_container">
                            <!--{if  $val['picAddr1']}-->
                            <a href="#"><img src="{$val['picAddr1']}" /></a>
                            <!--{/if}-->
                            <!--{if  $val['picAddr2']}-->
                            <a href="#"><img src="{$val['picAddr2']}" /></a>
                            <!--{/if}-->
                            <!--{if  $val['picAddr3']}-->
                            <a href="#"><img src="{$val['picAddr3']}" /></a>
                            <!--{/if}-->
                            <!--{if  $val['picAddr0']}-->
                            <a href="#"><img src="{$val['picAddr0']}" /></a>
                            <!--{/if}-->

                        </div>
                    </div>
                </td>
                <td width="300" >
                    <table>
                        <tr>
                           <td>货号:</td>
                            <td>{$val['materialNo']}</td>
                        </tr>
                        <tr>
                            <td>销售笔数:</td>
                            <td>{$val['total']}</td>
                        </tr>
                        <tr>
                            <td>销售单价:</td>
                            <td>{$val['price']}</td>
                        </tr>
                        <tr>

                            <td><a href="{$this->url($c,'addClothEvaluate', array('type' => 'infoShow','id'=>$val['id']))}">添加评价</a></td>
                            <td><a href="{$this->url($c,'lookClothEvaluate', array('type' => 'infoShow','sn'=>$val['sn']))}">历史评价</a></td>
                        </tr>
                    </table>
                </td>

            </tr>



            <!--{/loop}-->
            <script type="text/javascript" src="content/js/slides.min.jquery.js"></script>

            <script type="text/javascript">
                $(".slideshow").slides({
                    effect: 'fade',
                    play: 5000,
                    pause: 2500,
                    hoverPause: true
                });
            </script>
            <!--{else}-->
            <tr>
                <td colspan="6">热卖商品信息</td>
            </tr>

            <!--{/if}-->

            <!--{if $pager}-->
            <!--分页开始-->
            <tr>
                <td colspan="6">
                    <div class="page">{$pager}</div>
                </td>
            </tr>
            <!--分页结束-->
            <!--{/if}-->



        </table>

        <!--{/if}-->
        <!--{/if}-->
        <!--{if $a == 'addClothEvaluate'}-->
        <form method="post" action="{$this->url($c, 'saveClothEvaluate')}">
            <input type="hidden" name="attach[id]" value="" />
            <table cellpadding="1" cellspacing="1" border="0" width="100%">
                <tr>
                    <td class="td1" width="25%">服装编号：</td>
                    <td class="td2 operate">
                        <input type="text" name="sn" placeholder="请输入商品编号" class="required" value="{$result['sn']}"/>
                        <a format="YmdHis" class="sn" href="{$this->url($c)}">自动生成</a>
                    </td>
                </tr>
                <tr>
                    <td class="td1" width="30%">服装评分：</td>
                    <td class="td2">
                        <select name="vote">

                            <!--{loop $this->clothScore  $k $v}-->
                            <option value="{$k}">{$v}</option>
                            <!--{/loop}-->

                        </select>
                    </td>


                </tr>
                <td class="td1" width="30%">服装评价：</td>
                <td class="td2">
                    <!-- class="required" 必填字段  -->
                    <input type="text" size="20" name="comments" placeholder="" class="required" value="{$a == 'edit' ? $result['comment'] : ''}" />

                </td>
                <tr>

                </tr>


                <tr>
                    <td colspan="1" class="td1">
                        <a class="btn btn-success save" href="{$this->url($c, 'lookHotSalePic', array('type'=>'infoShow'))}">保存</a>
                    </td>
                    <td colspan="1" class="td1">
                        <a class="btn btn-success save" href="{$this->url($c)}">重置</a>
                    </td>
                </tr>
            </table>
        </form>
        <!--{/if}-->
        <!--{if $a == 'lookClothEvaluate'}-->
        <table cellpadding="1" cellspacing="1" border="0" width="100%">




            <tr>
                <th width="15%">服装编号</th>
                <th>评分</th>
                <th>评价</th>
                <th>评论员</th>
                <th>评价时间</th>
            </tr>

            <!--{if $result}-->
            <!--{loop $result  $v}-->
            <tr>

                <td>{$v['sn']}</td>
                <td>{$v['vote']}</td>
                <td>{$v['comments']}</td>
                <td>{$v['user']}</td>
                <td>{$v['dateline']}</td>
            </tr>
            <!--{/loop}-->


            <!--{if $pager}-->
            <!--分页开始-->
            <tr>
                <td colspan="5">
                    <div class="page">{$pager}</div>
                </td>
            </tr>
            <!--分页结束-->
            <!--{/if}-->

            <!--{else}-->
            <tr>
                <td colspan="5">没有数据记录！</td>
            </tr>
            <!--{/if}-->

        </table>

        <!--{/if}-->

    </div>
    <!-- artile end -->

    <script type="text/javascript">

    $( ".sn" ).click( function () {
        var c = $( this ).attr( 'class' );
        $.get( "{$this->url($c, 'get_date')}&format=" + $( this ).attr( 'format' ), function ( result ) {
            $( 'input[name="' + c + '"]' ).val( result );
            $( 'input[name="' + c + '"]' ).focus();
        });
        return false;
    });
</script>

{template footer}